<script lang="ts" setup>
import { AuthenticationLogin } from '@vben/common-ui';

import { useAuthStore } from '#/store';
import { reactive, ref, onMounted} from 'vue';
import { uctoo_config } from '#/store';
import { useRepo } from 'pinia-orm';
import { useAxiosRepo } from '@pinia-orm/axios';

defineOptions({ name: 'Login' });

const authStore = useAuthStore();
const showVerifyCode = ref(false);
onMounted(async () => {
  const params: Record<string, any> = {};
 // params.filter = JSON.stringify({"key":{"equals":"EnableVerifyCode"}});
  params.filter = JSON.stringify({"key" : "EnableVerifyCode"});
  await useAxiosRepo(uctoo_config).api().getuctooConfigList(0, 9, params);
  const verifyCodeConfig = useRepo(uctoo_config).where('key', "EnableVerifyCode").first();
  console.log('res', verifyCodeConfig);
  showVerifyCode.value = verifyCodeConfig?.value === '1' ? true : false;
});
</script>

<template>
  <AuthenticationLogin
    :loading="authStore.loginLoading"
    password-placeholder=""
    username-placeholder=""
    verify-code-placeholder=""
    verify-qr-code="https://imeal.weiyoho.com/assets/qrcode/verify.png"
    :showVerifyCode=showVerifyCode
    @submit="authStore.authLogin"
  />
</template>
